import request from '@/utils/request'

// 获取秒杀列表 (门店级秒杀)
export function getSeckillList() {
    return request({
        url: '/dish-seckill-service/seckill/list',
        method: 'GET',
    })
}

// 获取秒杀详情
export function getSeckillDetail(params) {
    return request({
        url: '/dish-seckill-service/seckill/detail',
        method: 'GET',
        params
    })
}

// 购买秒杀商品 (门店级)
export function buySeckill(params) {
    return request({
        url: '/dish-seckill-service/seckill/buy',
        method: 'GET',
        params
    })
}

// 获取系统级秒杀套餐信息
export function getSystemSeckillPlan() {
    return request({
        url: '/seckill-service/seckill/getSkPlan',
        method: 'GET',
    })
}

// 参与系统级秒杀
export function startSystemSeckill(data) {
    return request({
        url: '/seckill-service/seckill/startSK',
        method: 'POST',
        data
    })
}

// 查询系统级秒杀库存
export function getSystemSeckillStock(seckillId) {
    return request({
        url: `/seckill-service/seckill/getSkPlanStock/${seckillId}`,
        method: 'GET',
    })
}

// 检查库存状态
export function checkSeckillStock(releaseId) {
    return request({
        url: `/dish-seckill-service/seckill/stock/${releaseId}`,
        method: 'GET',
    })
}

// 获取门店秒杀实时库存
export function getSeckillRealTimeStock(releaseId) {
    return request({
        url: `/dish-seckill-service/seckill/realtime-stock`,
        method: 'GET',
        params: { releaseId }
    })
}
